package com.lsk.util;

import com.google.gson.Gson;
import com.jfinal.upload.UploadFile;
import com.qiniu.common.QiniuException;
import com.qiniu.common.Zone;
import com.qiniu.http.Response;
import com.qiniu.storage.Configuration;
import com.qiniu.storage.UploadManager;
import com.qiniu.storage.model.DefaultPutRet;
import com.qiniu.util.Auth;


public class QiNiuConfig {
    public static  String qiNiuAccessKey="gt63f8kM_j5BjQmS46TRgY4UgBeJQoHEsMX3BnIm";  //七牛的AccessKey
    public static  String qiNiuSecretKey="Y1iF2b7tGL15RwV-TIzOy_fSYcNX5ImK4fU53FEg";  //七牛的secretKey
    public static String QiNiuPath="keleziyouxing";     //七牛上的空间


    public static  String Quickdomain ="http://lvyouimg.dingyuankeji.shop/";       //




    public QiNiuConfig() {
    }


    //生成上传文件凭证token
    public static String getClientTokenQiNiu(String bucket){
        Auth auth = Auth.create(qiNiuAccessKey, qiNiuSecretKey);//七牛的工具类
        String upToken = auth.uploadToken(bucket);
        return  upToken;
    }
    //构建服务端的上传地址
    public static UploadManager getuploadManger(){
        //构造一个带指定Zone对象的配置类
        Configuration cfg = new Configuration(Zone.zone0());
        //...其他参数参考类注释

        UploadManager uploadManager = new UploadManager(cfg);
        return  uploadManager;
    }


}
